package dao.user;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import entities.login.User;
import entities.organization.Company;
import entities.organization.Dept;
import entities.permission.Permission;
import entities.permission.Role;
/**
 * 用户管理
 * @author hxl
 *
 */
public interface UserManageDao {
   public List<User> getUsers(@Param("name")String name, @Param("offset")int start, @Param("rows")int rows);
   public Integer getUserCount(@Param("name")String name);
   
   @Select("Select * from dept where id=#{deptId}")
   public List<Dept> getDepts(@Param("deptId")String deptId);
   @Select("Select * from company where id=#{companyId}")
   public List<Company> getCompanys(@Param("companyId")String companyId);
   public User getUser(@Param("id")String id,@Param("name")String name);
   public void addUser(@Param("user")User user);
   public void updateUser(@Param("user")User user);
   public void delete(@Param("ids")List<String> idList);
   @Select("Select ur.roleId AS 'id',rl.name AS 'name',rl.remark AS 'remark' from userAndRole AS ur  left join role as rl on rl.id=ur.roleId  where ur.userId=#{userId}")
   public List<Role> getRoles(@Param("userId")String userId);
   public List<Permission> getPermissionAndMenus(@Param("roleId")String roleId);
}
